package com.lianqi.emcpframework.design.configuration;

import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import com.lianqi.emcpframework.design.domain.event.DomainEventBus;
import com.lianqi.emcpframework.design.support.event.DefaultDomainEventBus;

/**
 * @program emcp-framework
 * @ClassName EventBusAutoConfiguration
 * @description: 领域事件总线注册类
 * @author: sky
 * @create: 2019/06/06 20:05
 */
@Configuration
public class EventBusAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public DomainEventBus domainEventBus() {
        return new DefaultDomainEventBus();
    }

    @Bean
    public SpringDomainEventDispatcher springDomainEventDispatcher() {
        return new SpringDomainEventDispatcher();
    }

}
